In the nonvolatile memory express (NVMe) system, a host device writes data storage device commands, such as read commands, write commands, and administrative commands, in submission queues, which are implemented in host memory. The nonvolatile storage device fetches the commands from the submission queues, executes the commands, and places entries in completion queues, which are also implemented in host memory, to notify the host of completion of the commands.
When the host places new commands for a nonvolatile storage device in a submission queue, the host updates a tail entry pointer in the submission queue to point to the next available entry that is not currently filled with a command. When the storage device removes commands from a submission queue, the storage device updates a head entry pointer to point to the next command that has not been read. According to the NVMe standard, the current version of which is NVM Express, Revision 1.2, Nov. 3, 2014 (hereinafter, “NVMe Standard”), the disclosure of which is incorporated herein by reference in its entirety, “The consumer increments the Head entry pointer after retrieving the next entry from the queue.” (See NVMe Standard, Section 4.1.) The consumer of submission queue entries is the storage device. If this passage is read to mean that the storage device must inform the host after each command is retrieved from a submission queue, but before the command is successfully parsed by the storage device controller, the following error scenario could occur. If the command is not properly transmitted over the PCIe bus to the storage device and is unparseable by the storage device, it would be desirable for the storage device to be able to re-fetch the command from the submission queue. However, if the storage device informed the host to update the submission queue entry head pointer upon retrieval of the command, then the host is permitted to overwrite the submission queue entry with a new command. Because the previous command can be overwritten once the host is notified to advance the submission queue head entry pointer, the command in the previous location of the head entry pointer cannot be considered valid. There is no ability to re-fetch a command from a host side submission queue after the storage device has informed the host device to advance the submission queue head entry pointer upon fetching of the command.
One possible solution to this problem would be to only update the submission queue head entry pointer after all commands associated with a fetch operation are successfully executed by the storage device. However, such a solution may result in undesirable host side latency. For example, suppose the storage device retrieves five commands from a submission queue, quickly executes four of the commands, takes a long time to execute fifth command, and waits until all five commands have successfully executed to inform the host to advance the head entry pointer for the submission queue. The host is prevented from writing new commands to the submission queue entries for the first four commands even after the commands have been successfully executed, which could result in host device latency if the submission queue is full and the host is forced to wait for the head entry pointer to advance and before placing a new entry in the submission queue.
Accordingly, there exists a need for methods, systems, and computer readable media submission queue pointer management.